package com.doubao.msghadler;

import com.doubao.config.AppConstant;
import com.doubao.protocol.Msg;
import io.netty.channel.Channel;


/**
 * description:HandlerFactory
 * <p>
 * author:sult
 * time: 2018/11/2 11:33
 **/
public class HandlerFactory {

    public static AbstractMsgHandler getMsgHandler(Msg msg, Channel formChannel){
        AbstractMsgHandler msgHandler=null;
        switch (msg.getContentType()){
            case AppConstant.MSG_TYPE_MSG:
                msgHandler = new MsgHandler(msg,formChannel);
                break;
            case AppConstant.MSG_TYPE_STSTUS:
                msgHandler = new StatusHandler(msg,formChannel);
                break;
        }
        return msgHandler;
    }
}
